package com.cheer.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cheer.dao.OaActivityPartiDao;
import com.cheer.dto.ActivityToLeadExcelDTO;
import com.cheer.entity.OaActivityPartiEntity;
import com.cheer.entity.OaUserEntity;
import com.cheer.service.OaActivityPartiService;
import com.cheer.service.OaUserService;
import com.cheer.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.rmi.ServerException;
import java.util.List;

@Service
public class OaActivityPartiServiceImpl extends ServiceImpl<OaActivityPartiDao, OaActivityPartiEntity> implements OaActivityPartiService {

    @Override
    public Integer getParticipant(Integer actId) {
        QueryWrapper<OaActivityPartiEntity> qw = new QueryWrapper<>();
        qw.lambda().eq(OaActivityPartiEntity::getActivityId, actId);
        return count(qw);
    }

    @Override
    public OaActivityPartiEntity getByUserIdAndActId(Integer userId, Integer actId) {
        QueryWrapper<OaActivityPartiEntity> qw = new QueryWrapper<>();
        qw.lambda()
                .eq(OaActivityPartiEntity::getActivityId, actId)
                .eq(OaActivityPartiEntity::getUserId, userId);
        return getOne(qw);
    }


}
